package com.yunxi.controller.approve;

import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.CurrentUser;
import com.yunxi.core.web.LoginInfo;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.order.pojo.*;
import com.yunxi.order.service.RetailMonthlyPlanDubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/retailMonthlyPlan")
@Api(tags = "pms:retailMonthlyPlan", description = "分销月计划接口")
public class RetailApproveMonthlyPlanController {
    @Autowired
    private RetailMonthlyPlanDubboService retailMonthlyPlanDubboService;

    @ApiOperation(value = "厂商审核渠道商目标计划")
    @PostMapping(value = "/verify")
    public ApiResult<Boolean> verify(@CurrentUser LoginInfo user, @RequestBody RetailMonthlyPlanVerifyReqVO vo){
        boolean isSuccess = retailMonthlyPlanDubboService.verify(vo);
        return ResponseUtil.ok(isSuccess);
    }

    @ApiOperation(value = "厂商导出所有渠道商计划")
    @PostMapping(value = "/queryRetailMonthlyPlanForDownload")
    public ApiResult<RetailMonthlyPlanQueryRespVO> queryRetailMonthlyPlanForDownload(RetailMonthlyPlanQueryReqVO vo){
        List<RetailMonthlyPlanQueryRespVO> list = retailMonthlyPlanDubboService.queryRetailMonthlyPlanForDownload(vo);
        return ResponseUtil.ok(list);
    }
}
